<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="9">
        <exam-template-form
          :org-id="userInfo.orgId"
          ref="examTemplateFormRef"
          :template-master-id="templateMasterId"
          @submit-form-ok="examItemRefresh"
          @clear-form="clearForm"
        />
      </el-col>
      <el-col :span="15">
        <exam-template-table
          ref="applyTableRef"
          :org-id="userInfo.orgId"
        />
      </el-col>
    </el-row>
  </div>
</template>

<script lang="ts" setup>

import ExamTemplateForm from "@/views/template/wholeSet/examTemplate/examTemplateForm.vue";
import ExamTemplateTable from "@/views/template/wholeSet/examTemplate/examTemplateTable.vue";
import {useUserStoreHook} from "@/store/modules/user.ts";

const useUserStore = useUserStoreHook();
// 登录用户信息
const userInfo = <UserInfoBusi>useUserStore.user.userInfo;

const examTemplateFormRef = ref()
const props = defineProps({
  templateMasterId: {
    type: String,
    default: ""
  },
  orgId: {
    type: String,
    default: ""
  }
})

const emits = defineEmits(["clearForm"]);

const applyTableRef = ref()
function examItemRefresh() {
  nextTick(()=>{
    applyTableRef.value.getList()
  })
}

function clearForm () {
  nextTick(()=>{
    examTemplateFormRef.value.clearForm()
  })
}

defineExpose({
  examItemRefresh,
  clearForm
})
</script>

<style scoped>

</style>
